// 定义路由表数组
import React from 'react'
import { Navigate } from 'react-router-dom'

import Home from '../pages/Home'
import About from '../pages/About'
import PageNotFound from '../pages/PageNotFound'
import Message from '../pages/Message'
import News from '../pages/News'
const routes = [
  {
    path: '/',
    element: <Home />,
  },
  {
    path: '/home',
    element: <Home />,
    children: [
      {
        path: 'message',
        element: <Message />,
      },
      {
        path: 'news',
        element: <News />,
      },
      {
        path: '/home',
        element: <Navigate to='/home/news' />,
      }
    ],
  },
  {
    path: '/about',
    element: <About />,
  },
  {
    path: '*',
    element: <PageNotFound />,
  },
  {
    index: true,
    element: <Navigate to="/home" />,
  },
]

export default routes
